package com.foreknow.demo2;

/**
 * 数据类型的转换
 */
public class DataTypeConvert {
    public static void main(String[] args) {
       byte b =  28;
       int a = b; //自动类型转换 范围小-->范围大
       System.out.println(a);

       int z = 45;
       float f = z;  //整型向浮点类型转换
       System.out.println(f);

       char c = 'A';
       int x = c; //char类型转向int类型
       System.out.println(x); //输出的值参考asc码表

       System.out.println("-----------------------强制类型转换-------------------------");
       int aa = 97;
       byte bb = (byte) aa; //范围大-->范围小
       System.out.println(bb);

       double dd = 3.14;
       int zz = (int) dd;
       System.out.println(zz);

       //int转换为char类型
       int ii = 65;
       char jj = (char) ii;
       System.out.println(jj);

       boolean isRight = false;
       System.out.println(isRight);

       double money = 0.0;
       System.out.println(money);


    }
}
